home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
HTBasic 9.3
/
HTBasic 9.3.iso
/
60DOS
/
UIFUNCS.DAT
< prev
Wrap
Text File
|
2001-03-02
|
3KB
|
98 lines
@DefineProto
@VOID @RemoveINIKey(@IN @QString @Section, @IN @QString @Key, @IN @QString @KeyPath, @IN @QString @KeyValue, @IN @QString @INIPath, @IN @QString @INIFile)
@EndProto
//***********************************************************************************
// Variables:
@DefineVars
@QString @InputLine = ""
@QString @TmpINIFile = ""
@Integer @INICode = 0
@EndVars
//***********************************************************************************
// @RemoveINIKey function:
@DefineFunc @VOID @RemoveINIKey(
@IN @QString @Section,
@IN @QString @Key,
@IN @QString @KeyPath,
@IN @QString @KeyValue,
@IN @QString @INIPath,
@IN @QString @INIFile)
@TmpINIFile = "@INIPath\\Temp.ini"
@INICode = 0
@If(!@Exists("@INIPath@INIFile"))
@INICode = 100
@Return()
@EndIf
@Delete("@TmpINIFile")
@Write("@TmpINIFile", "WT", "")
// PROCESSLOOP:
INILOOP:
@If(@INICode == 0) // Start
@If(@ReadLine("@INIPath@INIFile", @InputLine) == -1) // If EOF
@INICode = 80
@Else
@INICode = 1
@EndIf
@ElseIf(@INICode == 1) // Check line for @Section
@If("@InputLine" == "[@Section]")
@INICode = 2
@Else
@Write("@TmpINIFile", "AT", "@InputLine\n")
@INICode = 0
@EndIf
@ElseIf(@INICode == 2) // In Section
@Write("@TmpINIFile", "AT", "@InputLine\n")
@If(@ReadLine("@INIPath@INIFile", @InputLine) == -1) // If EOF
@INICode = 80
@Else
@INICode = 3
@EndIf
@ElseIf(@INICode == 3)
@If(@StrFind("@InputLine", ";") == 0)
@INICode = 2
@Else
@INICode = 4
@EndIf
@ElseIf(@INICode == 4)
@If(@StrFind("@StrUpr(@InputLine)", "@StrUpr("@KeyPath@KeyValue")") == -1)
@INICode = 5
@Else //Found
@INICode = 6
@EndIf
@ElseIf(@INICode == 5) // Check for new Section
@If(@StrFind("@InputLine", "[") == 0)
@INICode = 80
@Else // Not found
@INICode = 2
@EndIf
@ElseIf(@INICode == 6) //Finish Writing
@If(@ReadLine("@INIPath@INIFile", @InputLine) == -1) // If EOF
@INICode = 99
@Else
@Write("@TmpINIFile", "AT", "@InputLine\n")
@INICode = 6
@EndIf
@ElseIf(@INICode == 80) //Finish Writing
@Delete("@TmpINIFile")
@INICode = 100
@Return()
@ElseIf(@INICode == 99)
@Delete("@INIPath\\@StrHead("@INIFile", @StrFind("@INIFile", ".")).HTU")
@Rename("@INIPath@INIFile", "@INIPath\\@StrHead("@INIFile", @StrFind("@INIFile", ".")).HTU")
@Rename("@TmpINIFile", "@INIPath@INIFile")
@INICode = 100
@Return()
@EndIf
@If(@INICode < 100)
@GOTO INILOOP
@EndIf
// end-of-INILOOP:
@Return()
@EndFunc // RemoveINIKey